#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <windows.h>
#include <sys/time.h>
using namespace std;
#define MAX 100000
int main()
{
	int N = 1000;
	while (N <= 50000)
	{
		int* a = new int[N];
		for (int i = 0; i < N; i++)a[i] = rand() % MAX;
		int* b = new int[N];
		for (int i = 0; i < N; i++)b[i] = a[i];
		int* c = b;
		cout << N << " ";
struct timeval time1, time2,time3;
	double loop1 = 0.0;
	double loop2 = 0.0;

    gettimeofday(&time1, NULL);
		for (int i = 0; i < N; i++)
		{
			a[i] = a[i] * 2000;
			a[i] = a[i] / 10000;
		}
        gettimeofday(&time2, NULL);
        loop1 = ((time2.tv_sec - time1.tv_sec) * 1000000.0 + (time2.tv_usec - time1.tv_usec));
		cout << loop1 << " ";

		for (int i = 0; i < N; i++)
		{
			*c = *c * 2000;
			*c = *c / 10000;
			c++;
		}

		gettimeofday(&time3, NULL);
		loop2 = ((time3.tv_sec - time2.tv_sec) * 1000000.0 + (time3.tv_usec - time2.tv_usec));
		cout << loop2 << " ";


		if (N < 10000) N += 1000;
		else if (N >= 10000 && N < 20000) N += 2000;
		else N += 5000;
	}
}
